package com.kingsoft.demo.xml.dom4j;

import java.util.Iterator;

import org.dom4j.Document;

import org.dom4j.Element;
import org.dom4j.io.SAXReader;


public class TestReader {

	public void readXml() throws Exception{
		
		SAXReader sr=new SAXReader();
		
		
		Document  doc=sr.read("src/emp.xml");
		
		Element root=doc.getRootElement();
		
		Iterator it_root=root.elementIterator("ROW");
		
		while(it_root.hasNext()){
			
			 Element el=  (Element) it_root.next();
		
			Iterator it_sal= el.elementIterator("SAL");
			while(it_sal.hasNext()){
				
				Element el1= (Element) it_sal.next();
				System.out.println(el1.getText());
			}			
		}
	}
	public static void main(String []args){
		
		TestReader tr=new TestReader();
		try{
			tr.readXml();
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}
}
